package com.xianyun.site.iblog.web.support;

import com.alibaba.cola.dto.Response;
import com.xianyun.site.support.api.SupportServiceI;
import com.xianyun.site.support.dto.SmsSendCmd;
import com.xianyun.site.support.dto.SmtpSendCmd;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * 数据支撑对外接口
 * @author mac_zyj
 */
@RequestMapping("/support")
@RestController
public class SupportController {

    @Autowired
    private SupportServiceI supportServiceI;

    
    @ResponseBody
    @PostMapping("/sms")
    public Response sendSms(@RequestBody @Valid SmsSendCmd cmd,
                            HttpServletRequest request){
        cmd.setSession(request.getSession().getId());
        return supportServiceI.sendCheckSms(cmd);
    }


    
    @ResponseBody
    @PostMapping("/smtp")
    public Response sendSmtp(@RequestBody @Valid SmtpSendCmd cmd,
                             HttpServletRequest request){
        cmd.setSession(request.getSession().getId());
        return supportServiceI.sendCheckSmtp(cmd);
    }

}
